#coding=utf-8
#!/usr/bin/python

import urllib2
import urllib
import SpUtil
# import  SpRegExpressions
# re = SpRegExpressions.SpRE()
# if re.execRE(r'(.)*地(.)*',"地下")== True:
#     print "T"
# else:
#     print "F"
#

#
req_header = {
'User-Agent':'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
# 'Accept':'text/html;q=0.9,*/*;q=0.8',
# 'Accept-Charset':'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
# 'Accept-Encoding':'gzip',
# 'Connection':'close',
# 'Referer':None #注意如果依然不能抓取的话，这里可以设置抓取网站的host
}
# url = "http://down.happytogether2015.com/freeone/file.php/NVSBMBf.html"
#
# # 1. request url
# request = urllib2.Request(url,None,req_header)
# response = urllib2.urlopen(request)
# page=response.read()
# print  page
#
# SpUtil.SpWrite("unittest.html",page)

# post reque
downUrl = "http://down.happytogether2015.com/freeone/down.php"
values = {
    'type':'torrent',
    'id':'NVSBMBf',
    'name':'1024w.net_olo%40SIS001%40RealityKingsTits+Gone+Wild-ellie+may'
}
data = urllib.urlencode(values)
print data

req = urllib2.Request(downUrl, data,req_header)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page